﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using Teigha.Core;

namespace Teigha.TD
{
	public class OdAveGraniteMaterial : OdAveMaterial
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdAveGraniteMaterial(IntPtr cPtr, bool cMemoryOwn) : base(TD_DbPINVOKE.OdAveGraniteMaterial_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdAveGraniteMaterial obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdAveGraniteMaterial()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							TD_DbPINVOKE.delete_OdAveGraniteMaterial(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public new static OdAveGraniteMaterial cast(OdRxObject pObj)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = TD_DbPINVOKE.OdAveGraniteMaterial_cast(OdRxObject.getCPtr(pObj));
			OdAveGraniteMaterial result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdAveGraniteMaterial)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdAveGraniteMaterial)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdAveGraniteMaterial)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxClass desc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdAveGraniteMaterial_desc(), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass isA()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdAveGraniteMaterial_isA(this.swigCPtr), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject queryX(OdRxClass protocolClass)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdAveGraniteMaterial_queryX(this.swigCPtr, OdRxClass.getCPtr(protocolClass)), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdAveGraniteMaterial createObject()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = TD_DbPINVOKE.OdAveGraniteMaterial_createObject();
			OdAveGraniteMaterial result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdAveGraniteMaterial)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdAveGraniteMaterial)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdAveGraniteMaterial)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual MaterialType type()
		{
			MaterialType result = (MaterialType)TD_DbPINVOKE.OdAveGraniteMaterial_type(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public double colorFactor(OdAveGraniteMaterial.GraniteColor graniteColor)
		{
			double result = TD_DbPINVOKE.OdAveGraniteMaterial_colorFactor(this.swigCPtr, (int)graniteColor);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public uint color(OdAveGraniteMaterial.GraniteColor graniteColor)
		{
			uint result = TD_DbPINVOKE.OdAveGraniteMaterial_color(this.swigCPtr, (int)graniteColor);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setColorFactor(OdAveGraniteMaterial.GraniteColor graniteColor, double colorFactor)
		{
			TD_DbPINVOKE.OdAveGraniteMaterial_setColorFactor(this.swigCPtr, (int)graniteColor, colorFactor);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setColor(OdAveGraniteMaterial.GraniteColor graniteColor, uint color)
		{
			TD_DbPINVOKE.OdAveGraniteMaterial_setColor(this.swigCPtr, (int)graniteColor, color);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public double sharpness()
		{
			double result = TD_DbPINVOKE.OdAveGraniteMaterial_sharpness(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setSharpness(double sharpness)
		{
			TD_DbPINVOKE.OdAveGraniteMaterial_setSharpness(this.swigCPtr, sharpness);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public double scale()
		{
			double result = TD_DbPINVOKE.OdAveGraniteMaterial_scale(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setScale(double scale)
		{
			TD_DbPINVOKE.OdAveGraniteMaterial_setScale(this.swigCPtr, scale);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		public enum GraniteColor
		{
			kFirst,
			kSecond,
			kThird,
			kFourth
		}
	}
}
